package com.rimi.project.controller;

import com.rimi.project.bean.User;
import com.rimi.project.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author chao
 * @date 2020/2/21
 */
@Controller
@RequestMapping("/user")
public class UserControoler {

    @Autowired
    UserService userService;

    @GetMapping("/list")
    public String listUser(Model model){
        List<User> allUser = userService.findAllUser();
        model.addAttribute("users",allUser);
        return "user/userlist";
    }
}
